package com.mydesignpattern.beijing.responsibilitychain.middle.impl;

import com.mydesignpattern.beijing.responsibilitychain.middle.*;

/**
 * 敏感词处理类
 * Created by nevermore on 17/4/25.
 */
public class SensitiveFilter implements Filter {
    @Override
    public void doFilter(Request request, Response response, FilterChain filterChain) {
        System.out.println("sensitivefilter 处理request");
        request.setRequestStr(request.getRequestStr().replace("敏感", "**").replace("失业","就业"));
        filterChain.doFilter(request, response, filterChain);
        System.out.println("sensitivefilter 处理response");
        response.setResponseStr(response.getResponseStr().replace("敏感", "**").replace("失业","就业"));
    }
}
